package com.wzxl.service.impl;

import com.wzxl.bean.User;
import com.wzxl.repository.UserDao;
import com.wzxl.service.UserService;
import com.wzxl.service.exception.ErrorCode;
import com.wzxl.service.exception.ServiceException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import javax.sql.rowset.serial.SerialException;

/**
 * @author 马浩 mahao@aowlx.onaliyun.com
 * @Package com.wzxl.service.impl
 * @Description: TODO (  )
 * @Date 2018/1/18 10:53
 * @Version V1.0
 */
@Service
public class UserServiceImpl implements UserService{

    @Autowired
    private UserDao userDao;

    @Override
    public User login(User user) {
        if (StringUtils.isEmpty(user)){
            throw new ServiceException("用户不能为空", ErrorCode.NULL_ERROR);
        }
        return userDao.selectOne(user);
    }
}
